<?php
$maint_log_title = $maint_log_subhead = "View a Project";
require_once("include_functions.php");
require_once("include_header.php");
?>
<div id="content">
<?php
$projId = clean($_REQUEST['projId']);
$sql =	"SELECT * ".
		"FROM projects ".
		"WHERE projects.projId = '". $projId ."';";
if($result = mysql_query($sql)) echo mysql_error();
while($proj = mysql_fetch_array($result, MYSQL_ASSOC)) {
?>
	<div class="proj-page-row">
		<div class="proj-title"><?php echo $proj['projName'];?>
			<div class="proj-dates">
				Project Created:<?php echo $proj['projCreatedDate'];?><br />
				Requested By:<?php echo $proj['projRequestedDate'];?><br />
				Started On:<?php echo $proj['projStartedDate'];?><br />
				Completed On:<?php echo $proj['projCompletedDate'];?>
			</div>
		</div>
		<div class="proj-desc"><?php echo nl2br($proj['projDescription']);?></div>
	</div>
	<h1 style="clear:both; padding-top: 25px;">Notes</h1>

<?php
}
$sql =	"SELECT * ".
		"FROM notes ".
		"WHERE projId = '". $projId ."';";
if($result = mysql_query($sql)) echo mysql_error();
while($note = mysql_fetch_array($result, MYSQL_ASSOC)) {
?>
	<div class="note">
		<span class="note-body">
			<?php echo $note['note'];?>
		</span>
		<span class="note-data">
			Submitted By:<?php echo $note['submitterName'];?></br>
			Date:<?php echo nl2br($note['submittedDate']);?>
		</span>
	</div>

<?php
}
?>

	<div class="form-box">
	<form action="manage_projects.php" method="post">
		<div class="form-title">
			Add Note
		</div>
		<div>
			<label for="submitterName">Submitted By:</label>
			<input type="text" name="submitterName" id="submitterName" />
		</div>
		<div>
			<label for="note">Note:</label>
			<textarea rows="10" cols="50" name="note" id="note"></textarea>
		</div>
		<div class="buttons">
			<input type="hidden" name="projId" value="<?php echo $projId; ?>" />
			<input type="hidden" name="action" value="addnote" />
			<input type="submit" name="submit" value="submit">
			<input type="reset" value="reset"></td></tr>
		</div>
	</form>
	</div>
</div>

<?
require_once("include_footer.php");
?>
